|
|
|
|
|
|
|
The code in Listing 5.14 is typical of property-handling routines. The main job of these routines is to transfer values between the control and its "host" program. Note the use of the PropertyChanged method. This method informs Visual Basic that the property has been updated and forces Visual Basic to update the design-time properties Window and fire off the event needed to update the stored properties. |
|
|
|
|
|
|
|
|
You need to declare Public properties for the Digits and Numeric storage values. Use the same process you used for the UpperCase property. Select Tools | Add Procedure; enter the property name (for example, Digits); select the Property and Public option buttons, and then press Enter. Do this for both the Digits and Numeric properties. |
|
|
|
|
|
|
|
|
Listing 5.15 shows the code to add to the Digits property Let and Get routines. |
|
|
|
|
|
|
|
|
Listing 5.15. Coding the Digits property Let and Get routines. |
|
|
|
|
|
|
|
|
Public Property Get Digits() As Boolean
Digits = m_Digits
End Property
Public Property Let Digits(ByVal New_Digits As Boolean)
m_Digits = New_Digits
PropertyChanged "Digits"
End Property |
|
|
|
|
|
|
|
|
After adding the Digits code, add the code from Listing 5.16 to the Numeric property Let and Get routines. |
|
|
|
|
|
|
|
|
Listing 5.16. Coding the Numeric property Let and Get routines. |
|
|
|
|
|
|
|
|
Public Property Get Numeric() As Boolean
Numeric = m_Numeric
End Property
Public Property Let Numeric(ByVal New_Numeric As Boolean)
m_Numeric = New_Numeric
PropertyChanged "Numeric"
End Property |
|
|
|
|
|
|
|
|
There is one final property you need to createthe Text property. Unlike the three other properties, which are unique to this control, the Text property is "mapped" to the Text property of the TextBox control that appears as part of the VText control. Even though the Text property exists for the TextBox, you must publish the Text property for the VText control before users can access any data in the Text1.Text control. After using Tools | Add |
|
|
|
|
|